<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="de.laures.cewolf.ChartPostProcessor"%>
<%@page import="java.awt.*" %>
<%@page import="java.util.*"%>
<%@page import="de.laures.cewolf.*"%>
<%@page import="de.laures.cewolf.cpp.*"%>
<%@page import="de.laures.cewolf.example.*"%>
<%@page import="de.laures.cewolf.links.*"%>
<%@page import="de.laures.cewolf.taglib.CewolfChartFactory" %>
<%@page import="de.laures.cewolf.tooltips.*"%>
<%@page import="org.jfree.chart.*"%>
<%@page import="org.jfree.chart.event.ChartProgressEvent" %>
<%@page import="org.jfree.chart.event.ChartProgressListener" %>
<%@page import="org.jfree.chart.plot.*"%>
<%@page import="org.jfree.data.*"%>
<%@page import="org.jfree.data.category.*"%>
<%@page import="org.jfree.data.gantt.*"%>
<%@page import="org.jfree.data.general.*"%>
<%@page import="org.jfree.data.time.*"%>
<%@page import="org.jfree.data.xy.*"%>
<%@taglib uri="http://cewolf.sourceforge.net/taglib/cewolf.tld" prefix="cewolf" %>
<jsp:useBean id="pieEnhancer" class="de.laures.cewolf.cpp.PieEnhancer" />

<jsp:useBean id="pageViews" class="de.laures.cewolf.example.BarData"/>

<%
DatasetProducer categoryData = new DatasetProducer() {
    public Object produceDataset(Map params) {
      final String[] categories = { "apples", "pies", "bananas", "oranges" };
      final String[] seriesNames = { "Peter", "Helga", "Franz", "Olga" };
      final Integer[][] startValues = new Integer[seriesNames.length][categories.length];
      final Integer[][] endValues = new Integer[seriesNames.length][categories.length];
      for (int series = 0; series < seriesNames.length; series++) {
        for (int i = 0; i < categories.length; i++) {
          int y = (int) (Math.random() * 10 + 1);
          startValues[series][i] = new Integer(y);
          endValues[series][i] = new Integer(y + (int) (Math.random() * 10));
        }
      }
      DefaultIntervalCategoryDataset ds = new DefaultIntervalCategoryDataset(seriesNames, categories, startValues, endValues);
      return ds;
    }
    public String getProducerId() {
      return "CategoryDataProducer";
    }
    public boolean hasExpired(Map params, Date since) {
      return false;
    }
  };
  pageContext.setAttribute("categoryData", categoryData);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/global.js"></script>
<script type="text/javascript" src="js/tooltip.js"></script>
<link type="text/css" href="style/cewolf.css" rel="stylesheet">
</head>
<body>
<div>
<cewolf:chart id="horizontalBarChart" title="HorizontalBar" type="horizontalBar"  xaxislabel="Fruit" yaxislabel="favorite">
    <cewolf:data>
        <cewolf:producer id="categoryData" />
    </cewolf:data>
</cewolf:chart>
<cewolf:img chartid="horizontalBarChart" renderer="/cewolf" width="800" height="400">
</cewolf:img>
</div>
<div>
<cewolf:chart id="verticalBar" title="VerticalBarChart" type="verticalBar" xaxislabel="Fruit" yaxislabel="favorite">
    <cewolf:data>
        <cewolf:producer id="categoryData" />
    </cewolf:data>
</cewolf:chart>
<cewolf:img chartid="verticalBar" renderer="/cewolf" width="800" height="400"/>
</div>
<div>
<cewolf:chart id="stackedHorizontalBar" title="StackedHorizontalBar" type="stackedHorizontalBar" xaxislabel="Fruit" yaxislabel="favorite">
    <cewolf:data>
        <cewolf:producer id="pageViews" >
        	<cewolf:param name="beg" value="123"></cewolf:param>
        
        </cewolf:producer>
    </cewolf:data>
</cewolf:chart>
<cewolf:img chartid="stackedHorizontalBar" renderer="/cewolf" width="800" height="400">
	<cewolf:map linkgeneratorid="pageViews" tooltipgeneratorid="pageViews"/>
</cewolf:img>
</div>
<div>
<cewolf:chart id="stackedVerticalBar" title="StackedVerticalBar" type="stackedVerticalBar" xaxislabel="Fruit" yaxislabel="favorite">
    <cewolf:data>
        <cewolf:producer id="pageViews" />
    </cewolf:data>
</cewolf:chart>
<cewolf:img chartid="stackedVerticalBar" renderer="/cewolf" width="800" height="400">
	<cewolf:map linkgeneratorid="pageViews" tooltipgeneratorid="pageViews"/>
</cewolf:img>
</div>
</body>
</html>